go/types.operand.typ (method)
283 uses
go/types (current package)
assignments.go#L43: if isUntyped(x.typ()) {
assignments.go#L58: target = Default(x.typ())
assignments.go#L62: if T == nil && x.typ() == Typ[UntypedNil] {
assignments.go#L67: target = Default(x.typ())
assignments.go#L89: if newType != x.typ() {
assignments.go#L121: if !x.isValid() || !isValid(x.typ()) || !isValid(lhs.typ) {
assignments.go#L136: assert(isConstType(x.typ()))
assignments.go#L140: lhs.typ = x.typ()
assignments.go#L156: if !x.isValid() || !isValid(x.typ()) || !isValid(lhs.typ) {
assignments.go#L166: typ := x.typ()
assignments.go#L221: if !x.isValid() || !isValid(x.typ()) {
assignments.go#L245: return x.typ()
assignments.go#L283: res = append(res, x.typ())
builtins.go#L115: for _, u := range typeset(y.typ()) {
builtins.go#L128: sig = makeSig(x.typ(), x.typ(), y.typ())
builtins.go#L137: sig = makeSig(x.typ(), x.typ(), NewSlice(E)) // []E required for variadic signature
builtins.go#L154: switch t := arrayPtrDeref(x.typ().Underlying()).(type) {
builtins.go#L189: if !isTypeParam(x.typ()) {
builtins.go#L192: if underIs(x.typ(), func(u Type) bool {
builtins.go#L213: if isValid(x.typ().Underlying()) {
builtins.go#L225: check.recordBuiltinType(call.Fun, makeSig(Typ[Int], x.typ()))
builtins.go#L236: if !underIs(x.typ(), func(u Type) bool {
builtins.go#L249: check.recordBuiltinType(call.Fun, makeSig(nil, x.typ()))
builtins.go#L254: if !underIs(x.typ(), func(u Type) bool {
builtins.go#L270: check.recordBuiltinType(call.Fun, makeSig(nil, x.typ()))
builtins.go#L279: if isUntyped(x.typ()) {
builtins.go#L282: if isUntyped(y.typ()) {
builtins.go#L290: check.convertUntyped(x, y.typ())
builtins.go#L293: check.convertUntyped(y, x.typ())
builtins.go#L305: if isNumeric(x.typ()) && constant.Sign(constant.Imag(x.val)) == 0 {
builtins.go#L323: if !Identical(x.typ(), y.typ()) {
builtins.go#L324: check.errorf(x, InvalidComplex, invalidOp+"%v (mismatched types %s and %s)", call, x.typ(), y.typ())
builtins.go#L346: check.errorf(x, InvalidComplex, invalidArg+"arguments have type %s, expected floating-point", x.typ())
builtins.go#L358: check.recordBuiltinType(call.Fun, makeSig(resTyp, x.typ(), x.typ()))
builtins.go#L389: for _, u := range typeset(y.typ()) {
builtins.go#L406: if !allString(y.typ()) {
builtins.go#L419: check.recordBuiltinType(call.Fun, makeSig(Typ[Int], x.typ(), y.typ()))
builtins.go#L428: map_ := x.typ()
builtins.go#L462: if isUntyped(x.typ()) {
builtins.go#L466: if isNumeric(x.typ()) {
builtins.go#L504: check.errorf(x, code, invalidArg+"argument has type %s, expected complex type", x.typ())
builtins.go#L520: check.recordBuiltinType(call.Fun, makeSig(resTyp, x.typ()))
builtins.go#L581: check.recordBuiltinType(call.Fun, makeSig(x.typ(), types...))
builtins.go#L599: if !allOrdered(a.typ()) {
builtins.go#L611: if !Identical(x.typ(), a.typ()) {
builtins.go#L612: check.errorf(a, MismatchedTypes, invalidArg+"mismatched types %s (previous argument) and %s (type of %s)", x.typ(), a.typ(), a.expr)
builtins.go#L638: check.updateExprType(a.expr, x.typ(), true)
builtins.go#L644: types[i] = x.typ()
builtins.go#L646: check.recordBuiltinType(call.Fun, makeSig(x.typ(), types...))
builtins.go#L660: check.validVarType(arg, x.typ())
builtins.go#L663: if isUntyped(x.typ()) {
builtins.go#L669: assert(isTyped(x.typ()))
builtins.go#L675: T := x.typ()
builtins.go#L679: check.recordBuiltinType(call.Fun, makeSig(x.typ(), T))
builtins.go#L718: params[i] = a.typ()
builtins.go#L732: check.recordBuiltinType(call.Fun, makeSig(x.typ()))
builtins.go#L752: check.recordBuiltinType(call.Fun, makeSig(x.typ(), x.typ(), y.typ()))
builtins.go#L762: if check.hasVarSize(x.typ()) {
builtins.go#L765: check.recordBuiltinType(call.Fun, makeSig(Typ[Uintptr], x.typ()))
builtins.go#L769: x.val = constant.MakeInt64(check.conf.alignof(x.typ()))
builtins.go#L790: base := derefStructPtr(x.typ())
builtins.go#L850: if check.hasVarSize(x.typ()) {
builtins.go#L853: check.recordBuiltinType(call.Fun, makeSig(Typ[Uintptr], x.typ()))
builtins.go#L856: size := check.conf.sizeof(x.typ())
builtins.go#L871: u, _ := commonUnder(x.typ(), nil)
builtins.go#L886: check.recordBuiltinType(call.Fun, makeSig(x.typ(), ptr, y.typ()))
builtins.go#L893: u, _ := commonUnder(x.typ(), nil)
builtins.go#L903: check.recordBuiltinType(call.Fun, makeSig(x.typ(), slice))
builtins.go#L923: check.recordBuiltinType(call.Fun, makeSig(x.typ(), NewPointer(universeByte), y.typ()))
builtins.go#L938: check.recordBuiltinType(call.Fun, makeSig(x.typ(), Typ[String]))
builtins.go#L945: if x.mode() != constant_ || !isBoolean(x.typ()) {
builtins.go#L994: for _, u := range typeset(x.typ()) {
builtins.go#L1086: if tp, _ := Unalias(x.typ()).(*TypeParam); tp != nil {
builtins.go#L1130: return f(x.typ())
call.go#L62: sig := x.typ().(*Signature)
call.go#L202: T := x.typ()
call.go#L254: u, err := commonUnder(x.typ(), func(t, u Type) *typeError {
call.go#L346: if x.mode() == value && sig.TypeParams().Len() > 0 && isParameterized(sig.TypeParams().list(), x.typ()) {
call.go#L385: assert(n < x.typ().(*Signature).TypeParams().Len())
call.go#L422: if t, ok := x.typ().(*Tuple); ok && x.isValid() {
call.go#L585: if asig, _ := arg.typ().(*Signature); asig != nil && asig.TypeParams().Len() > 0 {
call.go#L655: asig := arg.typ().(*Signature)
call.go#L770: x.typ_ = x.typ().(*Pointer).base
call.go#L777: x.typ_ = x.typ().(*Signature).results.vars[0].typ
call.go#L803: if !check.isComplete(x.typ()) {
call.go#L824: if p, ok := x.typ().Underlying().(*Pointer); ok && !check.isComplete(p.base) {
call.go#L828: obj, index, indirect = lookupFieldOrMethod(x.typ(), x.mode() == variable, check.pkg, sel, false)
call.go#L831: if !isValid(x.typ().Underlying()) {
call.go#L843: check.errorf(e.Sel, InvalidMethodExpr, "invalid method expression %s.%s (needs pointer receiver (*%s).%s)", x.typ(), sel, x.typ(), sel)
call.go#L845: check.errorf(e.Sel, InvalidMethodExpr, "cannot call pointer method %s on %s", sel, x.typ())
call.go#L851: if isInterfacePtr(x.typ()) {
call.go#L852: why = check.interfacePtrError(x.typ())
call.go#L854: alt, _, _ := lookupFieldOrMethod(x.typ(), x.mode() == variable, check.pkg, sel, true)
call.go#L855: why = check.lookupError(x.typ(), sel, alt, false)
call.go#L865: check.errorf(e.X, MissingFieldOrMethod, "operand for field selector %s must be value of type %s", sel, x.typ())
call.go#L870: check.recordSelection(e, FieldVal, x.typ(), obj, index, indirect)
call.go#L885: check.recordSelection(e, MethodExpr, x.typ(), obj, index, indirect)
call.go#L913: params = append([]*Var{NewParam(sig.recv.pos, sig.recv.pkg, name, x.typ())}, params...)
call.go#L927: check.recordSelection(e, MethodVal, x.typ(), obj, index, indirect)
const.go#L37: if isTyped(x.typ()) {
const.go#L38: check.representable(x, x.typ().Underlying().(*Basic))
const.go#L270: if isNumeric(x.typ()) && isNumeric(typ) {
const.go#L278: if !isInteger(x.typ()) && isInteger(typ) {
const.go#L316: if newType != x.typ() {
conversions.go#L29: case isInteger(x.typ()) && isString(t):
conversions.go#L51: if !ok && isInteger(x.typ()) && isInteger(T) {
conversions.go#L68: if isString(x.typ()) && isBytesOrRunes(u) {
conversions.go#L72: if isInteger(x.typ()) && isInteger(u) {
conversions.go#L102: if isUntyped(x.typ()) {
conversions.go#L112: if isTypes2 && x.typ() == Typ[UntypedNil] {
conversions.go#L115: final = Default(x.typ()) // default type of untyped nil is untyped nil
conversions.go#L116: } else if x.mode() == constant_ && isInteger(x.typ()) && allString(T) {
conversions.go#L117: final = x.typ()
conversions.go#L146: V := Unalias(x.typ())
conversions.go#L287: errorf("cannot convert %s to type %s (in %s)", x.typ(), T.typ, Tp)
expr.go#L75: if !pred(x.typ()) {
expr.go#L146: x.typ_ = &Pointer{base: x.typ()}
expr.go#L162: if !allInteger(x.typ()) {
expr.go#L182: if isUnsigned(x.typ()) {
expr.go#L183: prec = uint(check.conf.sizeof(x.typ()) * 8)
expr.go#L199: u, err := commonUnder(x.typ(), func(t, u Type) *typeError {
expr.go#L222: if isTypeParam(x.typ()) {
expr.go#L229: if isTypeParam(x.typ()) {
expr.go#L389: if !x.isValid() || isTyped(x.typ()) || !isValid(target) {
expr.go#L390: return x.typ(), nil, 0
expr.go#L396: if m := maxType(x.typ(), target); m != nil {
expr.go#L415: switch x.typ().(*Basic).kind {
expr.go#L469: return Default(x.typ()), nil, 0
expr.go#L485: if !isValid(x.typ()) || !isValid(y.typ()) {
expr.go#L500: ok, _ := x.assignableTo(check, y.typ(), nil)
expr.go#L502: ok, _ = y.assignableTo(check, x.typ(), nil)
expr.go#L509: cause = check.sprintf("mismatched types %s and %s", x.typ(), y.typ())
expr.go#L521: typ := x.typ()
expr.go#L523: typ = y.typ()
expr.go#L534: case !Comparable(x.typ()):
expr.go#L536: cause = check.incomparableCause(x.typ())
expr.go#L539: case !Comparable(y.typ()):
expr.go#L541: cause = check.incomparableCause(y.typ())
expr.go#L548: case !allOrdered(x.typ()):
expr.go#L551: case !allOrdered(y.typ()):
expr.go#L571: check.updateExprType(x.expr, Default(x.typ()), true)
expr.go#L572: check.updateExprType(y.expr, Default(y.typ()), true)
expr.go#L583: if isTypeParam(x.typ()) || isTypeParam(y.typ()) {
expr.go#L585: if !isTypeParam(x.typ()) {
expr.go#L588: cause = check.sprintf("type parameter %s cannot use operator %s", errOp.typ(), op)
expr.go#L591: what := compositeKind(errOp.typ())
expr.go#L593: what = check.sprintf("%s", errOp.typ())
expr.go#L626: if allInteger(x.typ()) || isUntyped(x.typ()) && xval != nil && xval.Kind() == constant.Int {
expr.go#L651: if isUntyped(y.typ()) {
expr.go#L663: case allInteger(y.typ()):
expr.go#L664: if !allUnsigned(y.typ()) && !check.verifyVersionf(y, go1_13, invalidOp+"signed shift count %s", y) {
expr.go#L668: case isUntyped(y.typ()):
expr.go#L689: if !isInteger(x.typ()) {
expr.go#L706: if !isInteger(x.typ()) {
expr.go#L717: if isUntyped(x.typ()) {
expr.go#L748: if !allInteger(x.typ()) {
expr.go#L810: if !Identical(x.typ(), y.typ()) {
expr.go#L813: if isValid(x.typ()) && isValid(y.typ()) {
expr.go#L819: check.errorf(posn, MismatchedTypes, invalidOp+"%s (mismatched types %s and %s)", e, x.typ(), y.typ())
expr.go#L821: check.errorf(posn, MismatchedTypes, invalidOp+"%s %s= %s (mismatched types %s and %s)", lhs, op, rhs, x.typ(), y.typ())
expr.go#L835: if (x.mode() == constant_ || allInteger(x.typ())) && y.mode() == constant_ && constant.Sign(y.val) == 0 {
expr.go#L842: if x.mode() == constant_ && y.mode() == constant_ && isComplex(x.typ()) {
expr.go#L861: if op == token.QUO && isInteger(x.typ()) {
expr.go#L888: if isTyped(x.typ()) && isTyped(y.typ()) {
expr.go#L892: if allNumeric(x.typ()) != allNumeric(y.typ()) {
expr.go#L899: if isNonTypeParamInterface(x.typ()) || isNonTypeParamInterface(y.typ()) {
expr.go#L903: if allBoolean(x.typ()) != allBoolean(y.typ()) {
expr.go#L907: if allString(x.typ()) != allString(y.typ()) {
expr.go#L912: return hasNil(y.typ())
expr.go#L915: return hasNil(x.typ())
expr.go#L919: if isPointer(x.typ()) || isPointer(y.typ()) {
expr.go#L926: check.convertUntyped(x, y.typ())
expr.go#L930: check.convertUntyped(y, x.typ())
expr.go#L1004: switch t := x.typ().(type) {
expr.go#L1103: if isTypeParam(x.typ()) {
expr.go#L1107: if _, ok := x.typ().Underlying().(*Interface); !ok {
expr.go#L1132: check.validVarType(e.X, x.typ())
expr.go#L1133: x.typ_ = &Pointer{base: x.typ()}
expr.go#L1136: if !underIs(x.typ(), func(u Type) bool {
expr.go#L1249: if check.assertableTo(x.typ(), T, &cause) {
expr.go#L1258: check.errorf(e, ImpossibleAssert, "impossible type assertion: %s\n\t%s does not implement %s %s", e, T, x.typ(), cause)
expr.go#L1289: if t, ok := x.typ().(*Tuple); ok && x.isValid() {
expr.go#L1381: if t, ok := x.typ().(*Tuple); ok {
index.go#L33: if isValid(x.typ()) {
index.go#L39: if sig, _ := x.typ().Underlying().(*Signature); sig != nil && sig.TypeParams().Len() > 0 {
index.go#L52: if !check.isComplete(x.typ()) {
index.go#L56: switch typ := x.typ().Underlying().(type) {
index.go#L76: switch typ := x.typ().Underlying().(type) {
index.go#L127: if !isTypeParam(x.typ()) {
index.go#L134: if underIs(x.typ(), func(u Type) bool {
index.go#L225: if x.typ() == nil {
index.go#L244: typeset(x.typ())(func(t, u Type) bool {
index.go#L246: check.errorf(x, NonSliceableOperand, "cannot slice %s: no specific type in %s", x, x.typ())
index.go#L276: if !isTypeParam(x.typ()) {
index.go#L277: cu = x.typ().Underlying() // untyped string remains untyped
index.go#L284: if p, ok := x.typ().Underlying().(*Pointer); ok && !check.isComplete(p.base) {
index.go#L314: if isUntyped(x.typ()) {
index.go#L431: return x.typ(), -1
index.go#L446: return x.typ(), v
index.go#L461: if !allInteger(x.typ()) {
infer.go#L176: if isParameterized(tparams, par.typ) || isParameterized(tparams, arg.typ()) {
infer.go#L179: if isTyped(arg.typ()) {
infer.go#L180: if !u.unify(par.typ, arg.typ(), assign) {
infer.go#L181: errorf(par.typ, arg.typ(), arg)
infer.go#L343: max = arg.typ()
infer.go#L345: m := maxType(max, arg.typ())
infer.go#L347: err.addf(arg, "mismatched types %s and %s (cannot infer %s)", max, arg.typ(), tpar)
literals.go#L294: if Identical(vtyp, x.typ()) {
literals.go#L299: visited[xkey] = append(visited[xkey], x.typ())
operand.go#L71: func (x *operand) typ() Type {
operand.go#L133: switch x.typ() {
operand.go#L139: return fmt.Sprintf("nil (of type %s)", TypeString(x.typ(), qf))
operand.go#L143: if x.mode() == value && x.typ() == Typ[UntypedNil] {
operand.go#L158: expr = TypeString(x.typ(), qf)
operand.go#L177: if x.typ() != nil {
operand.go#L178: if isUntyped(x.typ()) {
operand.go#L179: buf.WriteString(x.typ().(*Basic).name)
operand.go#L200: if isValid(x.typ()) {
operand.go#L202: if isGeneric(x.typ()) {
operand.go#L210: tpar, _ := Unalias(x.typ()).(*TypeParam)
operand.go#L212: switch x.typ().(type) {
operand.go#L214: what := compositeKind(x.typ())
operand.go#L217: what = x.typ().Underlying().(*Basic).name
operand.go#L225: WriteType(&buf, x.typ(), qf)
operand.go#L318: return x.mode() == value && x.typ() == Typ[UntypedNil]
operand.go#L334: V := Unalias(x.typ())
operand.go#L439: errorf("cannot assign %s to %s (in %s)", x.typ(), T.typ, Tp)
range.go#L41: if t, ok := arrayPtrDeref(x.typ().Underlying()).(*Array); ok {
range.go#L68: k, v, cause, ok := rangeKeyVal(check, x.typ(), func(v goVersion) bool {
range.go#L98: rangeOverInt := isInteger(x.typ())
range.go#L175: if x.isValid() && !isInteger(x.typ()) {
range.go#L176: check.softErrorf(lhs, InvalidRangeExpr, "cannot use iteration variable of type %s", x.typ())
recording.go#L29: typ = x.typ()
recording.go#L32: typ = x.typ()
recording.go#L103: t0, t1 := a[0].typ(), a[1].typ()
stmt.go#L245: check.convertUntyped(&v, x.typ())
stmt.go#L263: if Identical(v.typ(), vt.typ) {
stmt.go#L271: seen[val] = append(seen[val], valueType{v.Pos(), v.typ()})
stmt.go#L349: T = x.typ()
stmt.go#L402: T = x.typ()
stmt.go#L492: if !allNumeric(x.typ()) {
stmt.go#L493: check.errorf(s.X, NonNumericIncDec, invalidOp+"%s%s (non-numeric type %s)", s.X, s.Tok, x.typ())
stmt.go#L612: if x.isValid() && !allBoolean(x.typ()) {
stmt.go#L639: if x.isValid() && !Comparable(x.typ()) && !hasNil(x.typ()) {
stmt.go#L640: check.errorf(&x, InvalidExprSwitch, "cannot switch on %s (%s is not comparable)", &x, x.typ())
stmt.go#L732: if isTypeParam(x.typ()) {
stmt.go#L734: } else if IsInterface(x.typ()) {
stmt.go#L840: if x.isValid() && !allBoolean(x.typ()) {
typexpr.go#L251: return x.typ()
typexpr.go#L266: return x.typ()
typexpr.go#L488: if isUntyped(x.typ()) || isInteger(x.typ()) {
typexpr.go#L499: if isInteger(x.typ()) {